<?php
session_start ();
include_once ('../connexpdo.php'); // pour inclure nos classes
include_once ('../class/config.inc.php');
$vretour = array ();
$type = $_POST ["type"];
if ($type == "tkassignes") {
	$vretour = array (
			"data" => affiche_tickets_assignés ( $_SESSION ['identifiant'] ) 
	);
} else if ($type == "tkattente") {
	$vretour = array (
			"data" => affiche_tout_tk_attente () 
	);
} else if ($type == "tk_express") {
	$vretour = array (
			"data" => retourne_form_ajout () 
	);
} else if ($type == "modif_pb_princ") {
	$vretour = array (
			"data" => modif_Problematique ( $_POST ['data'], $_POST ['idpb'] ) 
	);
} else if ($type == "set_invisible") {
	$vretour = array (
			"data" => set_invisible ( $_POST ['idpb'] ) 
	);
} else if ($type == "set_visible") {
	$vretour = array (
			"data" => set_visible ( $_POST ['idpb'] ) 
	);
} else if ($type == "ajout_pb") {
	$vretour = array (
			"data" => ajout_Problematique ( $_POST ['nature'] ) 
	);
} else if ($type == "ajout_pb_sec") {
	$vretour = array (
			"data" => ajout_Problematique_secondaire ( $_POST ['id'], $_POST ['nature'] ) 
	);
}else if ($type == "ajout_tk") {
	$vretour = array (
			"data" => ajout_Ticket()
	);
}
$vretour ["data"] = utf8_encode ( $vretour ["data"] );
echo json_encode ( $vretour );
?>